﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Threading.Tasks;
using Dapper;

namespace NiuX.Dapper.Repositories;

public partial class DapperRepository : IAsyncDisposable
{



    public Task<T> FirstOrDefaultAsync<T>(string sql, object param = null, IDbTransaction transaction = null, int? commandTimeout = null)
    {
        return DbConnection.QueryFirstOrDefaultAsync<T>(sql, param, transaction, commandTimeout);
    }


    public async ValueTask DisposeAsync()
    {
        if (_db is IAsyncDisposable disposable)
        {
            await disposable.DisposeAsync();
        }
    }

}